import request from '@/utils/request'

// @Tags coupon
// @Summary
// @Security ApiKeyAuth
// @Produce  application/json
// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
// @Router /api/coupon/list [post]
export const getCouponList = (data) => {
  return request({
    url: '/api/coupon/list',
    method: 'post',
    data
  })
}

// @Tags coupon详情
// @Summary
// @Security ApiKeyAuth
// @Produce  application/json
// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
// @Router /api/coupon/detail/{couponId} [get]
export const getCouponDetail = (couponId) => {
  return request({
    url: `/api/coupon/detail/${couponId}`,
    method: 'Get',
  })
}

// @Tags coupon更新
// @Summary
// @Security ApiKeyAuth
// @Produce  application/json
// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
// @Router /api/coupon/detail/{couponId} [Post]
export const updateCoupon = (data) => {
  return request({
    url: '/api/coupon/update',
    method: 'Post',
    data
  })
}

// @Tags 新增
// @Summary
// @Security ApiKeyAuth
// @Produce  application/json
// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
// @Router /api/coupon/add [Post]
export const addCoupon = (data) => {
  return request({
    url: '/api/coupon/add',
    method: 'Post',
    data
  })
}

// @Tags 优惠券上下架
// @Summary
// @Security ApiKeyAuth
// @Produce  application/json
// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
// @Router /api/coupon/add [Post]
export const setCouponStatus = (data) => {
  return request({
    url: '/api/coupon/status/set',
    method: 'Post',
    data
  })
}
